import { Injectable } from '@angular/core';
import {environment} from '../../environments/environment';

@Injectable({
  providedIn: 'root'
})
export class DefaultLanguageService {

  constructor() { }

  setDefaultLanguage(code){
    if(!code){
      code = 'en_US';//en_US,zh_CN
    }
    localStorage.setItem(environment.DEFAULT_LANGUAGE,code);
  }

  getDefaultLanguage():string{
    let defultLanguage = localStorage.getItem(environment.DEFAULT_LANGUAGE);
    if(!defultLanguage){
      defultLanguage = 'en_US';//en_US,zh_CN
      localStorage.setItem(environment.DEFAULT_LANGUAGE,defultLanguage);
    }
    return defultLanguage;
  }
}
